﻿@model VNWIKI_WEB.Models.DataList
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@{ int next = Convert.ToInt16(ViewData["index"]) + 1;
   int prev = Convert.ToInt16(ViewData["index"]) - 1;
   int photoNum = Convert.ToInt16(ViewData["photoNum"]);
}
<span id="page">Ảnh @next/@photoNum</span> <span class="prev">
    @if (prev >= 0)
    {
        <img src="../../images/left-arrow.png" />
    }
</span><span class="next">
    @if (next < photoNum)
    {
        <img src="../../images/right-arrow.png" />
    }
</span>
<img src="../../images/demo/@Model.Photo.Link" />
<script type="text/javascript">
                                        $(document).ready(function () {
                                            $('.prev').click(function () {
                                                                                          
                                                        var link = '<%= Url.Action("ViewAjax","Home")%>';
                                                        var data = "&albumID=" +<%=Model.Photo.AlbumID %> + "&index="+<%=prev %>;
                                                        $.ajax({
                                                            type: 'POST',
                                                            url: link,
                                                            data: data,
                                                            success: function (data) {
                                                                $('.images').html(data);
                                                          
                                                            }
                                                        });                                                                         
                                                    });
                                                    $('.next').click(function () {                        
                                                        var link = '<%= Url.Action("ViewAjax","Home")%>';
                                                        var data = "&albumID=" +<%=Model.Photo.AlbumID %> + "&index="+<%=next %>;
                                                        $.ajax({
                                                            type: 'POST',
                                                            url: link,
                                                            data: data,
                                                            success: function (data) {
                                                                $('.images').html(data);
                                                          
                                                            }
                                                        });                                                                         
                                                    });                                                  
                                                });
</script>
